﻿using System.Linq;
using ScriptBehind.Core;
using ScriptBehind.Core.Interfaces;
using ScriptBehind.Extensions;

namespace ScriptBehind.Scripts
{
    public class LocalMultipleFileScripts
    {
        public static ScriptCollection UsingWildCardSearch(string path)
        {
            return WildCardFileMatcher.GetMatches(path).Select(x => LocalFileScript.FromPath(x)).ToScriptCollection();
        }

        public static ScriptCollection UsingWildCardSearch(string path, InjectPosition injectPosition)
        {
            return WildCardFileMatcher.GetMatches(path).Select(x => LocalFileScript.FromPath(x, injectPosition)).ToScriptCollection();
        }

        public static ScriptCollection UsingWildCardSearch(string path, ICompressionStrategy compression)
        {
            return WildCardFileMatcher.GetMatches(path).Select(x => LocalFileScript.FromPath(x, InjectPosition.Default, compression)).ToScriptCollection();
        }

        public static ScriptCollection UsingWildCardSearch(string path, InjectPosition injectPosition, ICompressionStrategy compression)
        {
            return WildCardFileMatcher.GetMatches(path).Select(x => LocalFileScript.FromPath(x, injectPosition, compression)).ToScriptCollection();
        }
    }
}